package com.smileus.dal;

import java.util.List;

import com.ibatis.common.util.Page;



/**
  * FileName：BaseDAO.java
  * Date�?2010-12-7
  * User: heng.dong
  */
@SuppressWarnings("unchecked")
public interface BaseDAO {
	/**
	 * insert
	 *
	 * @param statementName
	 * @return
	 * @throws DataAccessException
	 *             Object
	 * @throws
	 */

	public Object insert(String statementName);

	/**
	 * insert
	 *
	 * @param statementName
	 * @param parameterObject
	 * @return Object
	 * @throws
	 */

	public Object insert(final String statementName, final Object parameterObject);

	/**
	 * update
	 *
	 * @param statementName
	 * @return @ int
	 * @throws
	 */

	public int update(String statementName);

	/**
	 * update
	 *
	 * @param statementName
	 * @param parameterObject
	 * @return int
	 * @throws
	 */

	public int update(final String statementName, final Object parameterObject);

	/**
	 * delete
	 *
	 * @param statementName
	 * @return @ int
	 * @throws
	 */

	public int delete(String statementName);

	/**
	  * delete
	  * @param statementName
	  * @param parameterObject
	  * @return
	  * int
	  * @throws
	  */

	public int delete(final String statementName, final Object parameterObject);
	/**
	 * 查询指定类型单个实体
	 *
	 * @param <T>
	 * @param statementName
	 * @param targetClass
	 * @return T
	 * @throws
	 */
	public <T> T queryForEntity(final String statementName, Class<T> targetClass);

	/**
	 * 查询指定类型单个实体
	 *
	 * @param <T>
	 * @param statementName
	 * @param targetClass
	 * @return T
	 * @throws
	 */
	public <T> T queryForEntity(final String statementName, final Object param, Class<T> targetClass);

	/**
	 * 查询指定类型的List
	 *
	 * @param <T>
	 * @param statementName
	 * @param targetClass
	 * @return T
	 */
	public <T> List<T> queryForList(String statementName, Class<T> targetClass);
	/**
	 * 查询指定类型的List
	 *
	 * @param <T>
	 * @param statementName
	 * @param targetClass
	 * @return T
	 */
	public <T> List<T> queryForList(String statementName, final Object param, Class<T> targetClass);

	/**
	 * 分页查询
	 *
	 * @param <T>
	 * @param statementName
	 * @param targetClass
	 * @return Page<T>
	 */

	public <T> Page<T> queryForPage(String statementName, Page page ,Class<T> targetClass);

	/**
	 * 分页查询
	 *
	 * @param <T>
	 * @param statementName
	 * @param param
	 * @param targetClass
	 * @return Page<T>
	 * @throws
	 */

	public <T> Page<T> queryForPage(String statementName,Page page , final Object param, Class<T> targetClass);

	/**
	 * 批量处理
	 *
	 * @param statementName
	 * @param list
	 *            void
	 * @throws
	 */
	public void batchOperation(final String statementName, final List list);
}
